<?php
namespace Admin\Controller;
use Think\Controller;
class CheckMasterController extends Controller {
    public function index(){

        // $mastersModel=M('masters');//构建一个操作masters表的模型实例
        // $masters=$mastersModel->where("m_states=0"/*必须是双引号*/)->select();
        // $this->index=$masters;
        // dump($masters);
        $mastersModel = M('masters');
        $qrcodenum = $mastersModel->where("m_states=0")->count();
        $Page = new \Think\Page($qrcodenum, 3);
        $Page->setConfig('header', '共<b>%TOTAL_ROW%</b>条记录&nbsp;&nbsp;
每页<b>3</b>条&nbsp;&nbsp;第<b>%NOW_PAGE%</b>页/共<b>%TOTAL_PAGE%</b>页');
        $Page->setConfig('prev', '上一页');
        $Page->setConfig('next', '下一页');
        $Page->setConfig('last', '末页');
        $Page->setConfig('first', '首页');
        $Page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
        $this->link = $Page->show();
        $this->index = $mastersModel->order('m_id desc')->where('m_states=0')->join('clubs  ON masters.cl_id=clubs.cl_id', 'left')->join('club_admins on clubs.cl_id = club_admins.ca_id', 'left')->limit($Page->firstRow, 3)->select();
        $this->display();
       

    }

	public function checkMaster($m_id){
    $mastersmodel=M('masters'); 
    $mastersmodel->m_states="1";
    if(false!==$mastersmodel->where("m_id=$m_id")->save()){
        $this->success('审核通过！');
    }else{
        $this->error('审核失败');
    }
    }
    public function checkoutMaster($m_id){
    $mastersmodel=M('masters'); 
    $mastersmodel->m_states="2";
    if(false!==$mastersmodel->where("m_id=$m_id")->save()){
        $this->success('审核不通过！');
    }else{
        $this->error('审核失败');
    }
    }

}
?>